<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="date" value="<%=new Date() %>"/>
<fmt:formatDate value="${date }" var="today" pattern="yyyyMMdd" type="date"  />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<script type="text/javascript" src="/${initParam.context_root }/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/${initParam.context_root }/jquery-ui-1.8.21.custom.min.js"></script>
<link type="text/css" href="/${initParam.context_root }/css/smoothness/jquery-ui-1.8.21.custom.css" rel="stylesheet"></link>
<script type="text/javascript">
	function deleteWish(i){
		var flag = window.confirm("정말 관심상품에서 삭제하시겠습니까?");
		if(flag){
			var url="/${initParam.context_root}/removeWish.do?productId="+i;
			$("#wishDelete").attr({"action":url,"method":"post"}).submit();
		}
		else{
			return false;
		}
		
	}
</script>
<h2>관심 상품 리스트</h2>
<table border=2 width=900px>
<tr>
		<th rowspan="2" width="5%" bgcolor="lightgray">no</th>
		<th rowspan="2" width="10%" bgcolor="lightgray">지역</th>
		<th rowspan="2" width="25%" bgcolor="lightgray">이미지</th>
		<th bgcolor="lightgray">상품명</th>
		<th rowspan="2" width="10%" bgcolor="lightgray">재고량</th>
		<th rowspan="2" width="10%" bgcolor="lightgray">가격</th>
		<th rowspan="2" width="10%" bgcolor="lightgray">마감일</th>
		<th rowspan="2" width="10%" bgcolor="lightgray">관심삭제</th>
	</tr>
	<tr>
		<th width="25%" bgcolor="lightgray">기간</th>
	</tr>
	<c:choose>
	
	<c:when test="${not empty requestScope.listWishDTO.list   }">
		<c:forEach items="${requestScope.listWishDTO.list }" var="pdto" varStatus="i">
		<tr>
			<td rowspan="2" width="5%">${i.count }</td>
			<td rowspan="2" width="10%">${pdto.saleLocation }</td>
			<td rowspan="2" width="25%"><img src="/${initParam.context_root }/upfile/${pdto.productImageFilename }" width=100px height=50px></td>
			<td >${pdto.productName }</td>
			<td rowspan="2" width="10%">${pdto.stockEA }</td>
			<td rowspan="2" width="10%">${pdto.reducedPrice }</td>
			<td rowspan="2" width="10%">${pdto.useEndDate } </td>
			<td rowspan="2" width="10%"><form id="wishDelete"><input type="button" value="삭제" onclick="deleteWish(${pdto.productId })"></form></td>
		</tr>
		<tr>
			<td width="25%">${pdto.useStartDate }~${pdto.useEndDate }</td>
		</tr>
		</c:forEach>
	</c:when>
	<c:when test="${ empty requestScope.productList }">
		<tr>
		<td colspan="8"><font color="red">관심상품이 없습니다.</font> 
		</td>
		</tr>
	</c:when>
	<c:when test="${not empty requestScope.message }">
		<tr>
		<td colspan="8"><font color="red">${reqeustScope.message }</font> 
		</td>
		</tr>
	</c:when>
	<c:otherwise>
		<tr>
		<td colspan="8"><font color="red">.</font> 
		</td>
		</tr>
	</c:otherwise>
	</c:choose>
</table>
<br>
<table cellpadding=12	border=2 bgcolor=#f8f8ff cellspacing=0 width= 200>
		<tr><td>
		<c:choose >
		<c:when test="${ requestScope.listWishDTO.pageDTO.previousPageGroup }"> 
			<a href="/${initParam.context_root }/selectWishListByPage.do?page=${requestScope.listWishDTO.pageDTO.currentPage -1}">◀</a>
		</c:when>
		<c:otherwise>◀</c:otherwise>
		</c:choose>
		<c:forEach begin="${requestScope.listWishDTO.pageDTO.startPageOfPageGroup }" end="${requestScope.listWishDTO.pageDTO.endPageOfPageGroup }" step="1" var="i">
			&nbsp;<font color=orange><B><a href="/${initParam.context_root }/selectWishListByPage.do?page=${i }">${i }</a></B></font>&nbsp;&nbsp;	
		</c:forEach>
		<c:choose >
		<c:when test="${ requestScope.listWishDTO.pageDTO.nextPageGroup }"> 
			<a href="/${initParam.context_root }/selectWishListByPage.do?page=${requestScope.listWishDTO.pageDTO.currentPage +1 }">▶</a>
		</c:when>
		<c:otherwise>▶</c:otherwise>
		</c:choose>
		</td></tr>
</table>

